<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

if ( ! function_exists('style_url'))
{
	function style_url($uri = '')
	{
		$CI =& get_instance();
		return $CI->config->base_url('assets/css/'.$uri.'.css');
	}
}

if ( ! function_exists('script_url'))
{
	function script_url($uri = '')
	{
		$CI =& get_instance();
		return $CI->config->base_url('assets/js/'.$uri.'.js');
	}
}

if ( ! function_exists('image_url'))
{
	function image_url($image_name = '')
	{
		$CI =& get_instance();
		return $CI->config->base_url('assets/img/'.$image_name);
	}
}

if ( ! function_exists('_accronymizer'))
{
	function _accronymizer($string = FALSE,$big = FALSE)
	{
		if($string !== FALSE)
		{
			$clean_string = htmlspecialchars(strip_tags($string));
			$number_of_words = str_word_count($clean_string,1);
			$accronym = array_map(function($x){
				if(strlen($x) > 1)
				{
					return $x[0];
				}
			},
			$number_of_words);

			$word = strtoupper(implode('',$accronym));
			$acc = $big == FALSE ? $word : strtoupper($word);
			
			return $acc;
		}else{
			return NULL;
		}
	}
}

if(!function_exists('__link'))
{
	function __link()
	{
		// get CI Instance
		$ci =& get_instance();

		$data = array_map(function($x){
			return intval($x);
		},func_get_args());
		
		return $ci->hs->encrypt($data);
	}
}

if(!function_exists('__link_array'))
{
	function __link_array($array = '')
	{
		// get CI Instance
		$ci =& get_instance();

		$data = array_map(function($x){
			return intval($x);
		},$array);
		
		return $ci->hs->encrypt($data);
	}
}

/*
* autmatic link for student portal
*/
if ( ! function_exists('student_portal_link'))
{
	function student_portal_link()
	{
		$CI =& get_instance();
		$url = $CI->config->item('student_url');
		return $url;
	}
}